package Package.Example;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

public class Example {
    public static final void Example() throws IOException {
        DatagramSocket ds=new DatagramSocket(10086);
       while (true){
           byte[] bys=new byte[1024];
           DatagramPacket dp=new DatagramPacket(bys,bys.length);
           ds.receive(dp);

           try {
               System.out.println(new String(dp.getData(),0,dp.getLength()));

           }catch (Exception e){
               ds.close();
           }
       }
    }
}
